package com.jiyun.springboot_user.controller;

import com.jiyun.springboot_user.entity.TbUserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@Api(tags = "tbUser接口")
@RequestMapping("/tbUser")
public class TbUserController {


	private final TbUserService service;

	@Autowired
	public TbUserController(TbUserService service) {
		this.service = service;
	}

	/**
	 * 查询
	 *
	 * @return
	 */
	@ApiOperation(value = "查询")
	@PostMapping(value = "/select")
	public List<TbUserEntity> select(@RequestBody TbUserEntity entity) {
		return service.select(entity);
	}

	/**
	 * 模糊查询
	 *
	 * @return
	 */
	@ApiOperation(value = "模糊查询")
	@PostMapping(value = "/likeSelect")
	public PageData<TbUserEntity> likeSelect(@RequestBody TbUserEntity entity) {
		return service.likeSelect(entity);
	}

	/**
	 * 更新
	 *
	 * @return
	 */
	@ApiOperation(value = "更新")

	@PostMapping(value = "/update")
	public void update(@RequestBody TbUserEntity entity) {
		service.update(entity);
	}

	/**
	 * 添加
	 *
	 * @return
	 */
	@ApiOperation(value = "添加")
	@PostMapping(value = "/add")
	public void add(@RequestBody TbUserEntity entity) {
		service.add(entity);
	}

	/**
	 * 删除
	 *
	 * @return
	 */
	@ApiOperation(value = "删除")
	@PostMapping(value = "/delete")
	public void delete(@RequestBody TbUserEntity entity) {
		service.delete(entity);
	}


}
